import request from '../utils/request';

// request(method, url, data, formData, headers)

export const loginResquest = (data) =>
  request(
    'POST',
    `head/admin/user/login?username=${data.username}&password=${data.password}`,
  );

// 多角色登录
export const mustRolesLogin = (data) =>
  request('POST', `head/admin/user/login/roles`, data);

// 获取用户信息
export const getUserInfo = () => request('GET', `head/admin/user/info`);

export const getPositionList = (params) =>
  request(
    'GET',
    `head/admin/position/positionList/plug?page=${params.page}&pageSize=${params.pageSize}&companyName=${params.companyName}&positionName=${params.positionName}`,
  );

// 添加简历库
export const addCandidate = (data) =>
  request('POST', `head/admin/create/addCandidateForPlug`, data, undefined, {
    'Content-Type': 'application/json',
  });

// 添加简历库
export const updateResume = (data) =>
  request('POST', `head/admin//update/candidate/plug`, data, undefined, {
    'Content-Type': 'application/json',
  });

// 加入职位
export const addPosition = (data) =>
  request(
    'POST',
    `head/admin/position/addPositionAndCandidate`,
    data,
    undefined,
    {
      'Content-Type': 'application/json',
    },
  );

// 简历查重
export const checkDuplicate = (data) =>
  request('POST', `head/admin/user/resume/recheck`, data, undefined, {
    'Content-Type': 'application/json',
  });

// 上传图片
export const uploadImg = (data) =>
  request('POST', `head/admin/user/upload`, undefined, data);
